package com.lhkj.ct.meta.admin.model.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.lhkj.ct.base.enums.DeleteStatus;
import com.lhkj.ct.base.enums.GlobalStatus;
import com.lhkj.ct.base.model.IBaseTree;
import com.lhkj.ct.base.validator.group.ValGroups;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 科室表
 * </p>
 *
 * @author jobob
 * @since 2023-08-31
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "TblDepartment对象", description = "科室表")
@TableName("tbl_department")
public class TblDepartment implements IBaseTree<String>, Serializable {

    private static final long serialVersionUID = 1L;

    @NotBlank(message = "id不能为空", groups = {ValGroups.Update.class})
    @ApiModelProperty(value = "主键")
    private String id;

    @NotBlank(message = "请选择上级科室", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "父级", notes = "上级科室，顶级为0", required = true)
    private String parentId;

    @Length(max = 50, message = "科室编码不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @NotBlank(message = "科室编码不能为空", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "科室编码", required = true)
    private String deptCode;

    @Length(max = 50, message = "科室名称不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @NotBlank(message = "科室名称不能为空", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "科室名称", required = true)
    private String deptName;

    @Length(max = 255, message = "科室英文名称不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "科室英文名称")
    private String deptEnName;

    @Length(max = 30, message = "科室简称不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "科室简称")
    private String deptAbbr;

    @Length(max = 50, message = "拼音简码不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "拼音简码")
    private String pyCode;

    @Length(max = 50, message = "五笔简码不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "五笔简码")
    private String wbCode;

    @Length(max = 30, message = "办公电话不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "办公电话")
    private String officePhone;

    @Length(max = 255, message = "科室地址不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "科室地址")
    private String deptAddress;

    @Length(max = 15, message = "负责人名称不能超过{max}字符", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "科室负责人")
    private String deptLeader;

    @NotNull(message = "排序不能为空", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "排序", required = true)
    private Integer sort;

    @ApiModelProperty(value = "备注")
    private String remark;

    @NotBlank(message = "机构id不能为空", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "机构id", required = true)
    private String organId;

    @NotNull(message = "科室状态不能为空", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "状态", notes = "0.正常 1.停用", example = "0", required = true)
    private GlobalStatus status;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人")
    private String createBy;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty(value = "修改人")
    private String updateBy;

    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty(value = "修改时间")
    private LocalDateTime updateTime;

    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "删除状态", notes = "0.未删除 1.已删除")
    private DeleteStatus delFlag;
    /**
     * 父节点id路径
     */
    @ApiModelProperty(value = "父节点id路径", hidden = true)
    @JsonIgnore
    private String treePath;

//    @TableField(exist = false)
//    @ApiModelProperty(value = "机构名称")
//    private String organName;

}
